

<?php
session_start();

mysql_connect("localhost","root","") or die ("sorry..");
mysql_select_db("books");
$username = $_POST['adminid'];
$passwd = $_POST['password'];

$qry ="select * from adminuser where adminid='". $username ."' and password='". $passwd ."' and status = 'active'";
$rs= mysql_query($qry);

if($rs)
 {
  $i=0;
  while($rs_data=mysql_fetch_array($rs))
  {
  $i++;
   $_SESSION['session_user']=$rs_data["username"];
   }
   if($i>0){
	header("location:adminhome.php");
	}
	else{

	header("location:adminlogin_error.php");
	}
}
else
{
die("login failed..................");
} 
?>
